{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# KNN exercise with NBA player data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "- NBA player statistics from 2014-2015 (partial season): [data](https://github.com/justmarkham/DAT4-students/blob/master/kerry/Final/NBA_players_2015.csv), [data dictionary](https://github.com/justmarkham/DAT-project-examples/blob/master/pdf/nba_paper.pdf)\n",
    "- **Goal:** Predict player position using assists, steals, blocks, turnovers, and personal fouls"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 1: Read the data into Pandas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# read the data into a DataFrame\n",
    "import pandas as pd\n",
    "url = 'https://raw.githubusercontent.com/justmarkham/DAT4-students/master/kerry/Final/NBA_players_2015.csv'\n",
    "nba = pd.read_csv(url, index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'season_end', u'player', u'pos', u'age', u'bref_team_id', u'g', u'gs',\n",
       "       u'mp', u'fg', u'fga', u'fg_', u'x3p', u'x3pa', u'x3p_', u'x2p', u'x2pa',\n",
       "       u'x2p_', u'ft', u'fta', u'ft_', u'orb', u'drb', u'trb', u'ast', u'stl',\n",
       "       u'blk', u'tov', u'pf', u'pts', u'G', u'MP', u'PER', u'TS%', u'3PAr',\n",
       "       u'FTr', u'TRB%', u'AST%', u'STL%', u'BLK%', u'TOV%', u'USG%', u'OWS',\n",
       "       u'DWS', u'WS', u'WS/48', u'OBPM', u'DBPM', u'BPM', u'VORP'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# examine the columns\n",
    "nba.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "G    200\n",
       "F    199\n",
       "C     79\n",
       "dtype: int64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# examine the positions\n",
    "nba.pos.value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 2: Create X and y\n",
    "\n",
    "Use the following features: assists, steals, blocks, turnovers, personal fouls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# map positions to numbers\n",
    "nba['pos_num'] = nba.pos.map({'C':0, 'F':1, 'G':2})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# create feature matrix (X)\n",
    "feature_cols = ['ast', 'stl', 'blk', 'tov', 'pf']\n",
    "X = nba[feature_cols]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# alternative way to create X\n",
    "X = nba.loc[:, 'ast':'pf']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# create response vector (y)\n",
    "y = nba.pos_num"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 3: Train a KNN model (K=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# import class\n",
    "from sklearn.neighbors import KNeighborsClassifier"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# instantiate with K=5\n",
    "knn = KNeighborsClassifier(n_neighbors=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_neighbors=5, p=2, weights='uniform')"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# fit with data\n",
    "knn.fit(X, y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 4: Predict player position and calculate predicted probability of each position\n",
    "\n",
    "Predict for a player with these statistics: 1 assist, 1 steal, 0 blocks, 1 turnover, 2 personal fouls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# create a list to represent a player\n",
    "player = [1, 1, 0, 1, 2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2], dtype=int64)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# make a prediction\n",
    "knn.predict(player)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0. ,  0.2,  0.8]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# calculate predicted probabilities\n",
    "knn.predict_proba(player)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 5: Repeat steps 3 and 4 using K=50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1], dtype=int64)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# repeat for K=50\n",
    "knn = KNeighborsClassifier(n_neighbors=50)\n",
    "knn.fit(X, y)\n",
    "knn.predict(player)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.06,  0.62,  0.32]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# calculate predicted probabilities\n",
    "knn.predict_proba(player)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bonus: Explore the features to decide which ones are predictive"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# allow plots to appear in the notebook\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# increase default figure and font sizes for easier viewing\n",
    "plt.rcParams['figure.figsize'] = (6, 4)\n",
    "plt.rcParams['font.size'] = 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "      <th>min</th>\n",
       "      <th>25%</th>\n",
       "      <th>50%</th>\n",
       "      <th>75%</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pos</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>79</td>\n",
       "      <td>0.945570</td>\n",
       "      <td>0.858263</td>\n",
       "      <td>0</td>\n",
       "      <td>0.40</td>\n",
       "      <td>0.80</td>\n",
       "      <td>1.15</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>F</th>\n",
       "      <td>199</td>\n",
       "      <td>1.173367</td>\n",
       "      <td>1.086252</td>\n",
       "      <td>0</td>\n",
       "      <td>0.45</td>\n",
       "      <td>0.90</td>\n",
       "      <td>1.50</td>\n",
       "      <td>7.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>G</th>\n",
       "      <td>200</td>\n",
       "      <td>2.729000</td>\n",
       "      <td>2.128287</td>\n",
       "      <td>0</td>\n",
       "      <td>1.10</td>\n",
       "      <td>2.25</td>\n",
       "      <td>3.80</td>\n",
       "      <td>10.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     count      mean       std  min   25%   50%   75%   max\n",
       "pos                                                        \n",
       "C       79  0.945570  0.858263    0  0.40  0.80  1.15   4.4\n",
       "F      199  1.173367  1.086252    0  0.45  0.90  1.50   7.3\n",
       "G      200  2.729000  2.128287    0  1.10  2.25  3.80  10.2"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# description of assists grouped by position\n",
    "nba.groupby('pos').ast.describe().unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1740b470>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEiCAYAAAAYv3I0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHylJREFUeJzt3XuYZFV57/HvD7yMYqRBPaJAaBXCRZA2BgVioPCoIR41\nmhA0MUpzUYIgEvUkosZhvMQYo4wSRNFAj6JGfQxIAghoKM/RyENEGzjc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ZKmCN9tSHo1jrSLp\nMuCaiDixdCxmS8llHGsbsfkdtGZDz8ne2iaqxaxVXMYxM2sBX9mbmbWAk72ZWQs42ZuZtYCTvZlZ\nCzjZm5m1gJO9mVkL/H/3muqHhM41pQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1740b908>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# box plot of assists grouped by position\n",
    "nba.boxplot(column='ast', by='pos')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[<matplotlib.axes._subplots.AxesSubplot object at 0x000000001740B780>,\n",
       "        <matplotlib.axes._subplots.AxesSubplot object at 0x00000000182EE7F0>],\n",
       "       [<matplotlib.axes._subplots.AxesSubplot object at 0x00000000183102E8>,\n",
       "        <matplotlib.axes._subplots.AxesSubplot object at 0x00000000184730F0>]], dtype=object)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEMCAYAAAAmgtofAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XnYHGWZ7/HvjyDEiQlwhAkgDsuIYCIDLnFhcsgbZmQU\nzwCKxGXECEcGMSiCXCCSwQTRcBSBoCCLCijKoh4YBMMBB4Iji5CQIxIMKBAFAkSYGCIkBJJ7/niq\nSaXfrburen1/n+vqi+6q6noqvN1197PeigjMzGxk26TdF2BmZu3nYGBmZg4GZmbmYGBmZjgYmJkZ\nDgZmZoaDgZmZ4WDQcSRtI+l0SYsl/UXSc5J+LWmOpO3afX1mrSDp45LWD/L4Rruvrxdt2u4LsA0k\nvRmYB4wFLgfOAdYDewKfAN4P7Na2CzRrvS8CD1Vte6AdF9LrHAw6hKQtgGtIN/+3RMRvq/Z/ATih\nHdd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PamGk7cI\n2LFgGdsBvwaIiPslvVRVzqLsmKLeDkyqDgRZuWsknQbcXbCMqcCBEfFbAElTgcuA+dlzM2tQM35B\nfQ34lqQLJB0saXL2OFjSBcB5wFcLlrE5qYnjZRFxHHAVcAsbmhEaFhFzgI8A35E0R9Ko/O6i58/M\nA47Ons8HplXtn8bgQbVWTwB7AEjajfQDYGJu/wT6LyXSiBWkpq3B7JodU8Q44M+VFxGxlvQ3Wkz6\n/1dGUDMbkUqvGUTEeZKeIa1kejhp3SJIs5QXAodGxFUFi3kQmETqlM6XfaykTYBrKOGGHRF3SnoL\ncCFwp6R/KXrOKp8HbpP0n8BdwHGSppD+XbuTakAHFSzjCuB7WdPavqR+ibmSxpMC6ueBKwuWAXAR\ncGnWIX4jGwLMeNKExBOBswqW8RBpifTfVTZExEuSPkz6N/wUJ04wa0xENO0BbEZq/tge2KzE854E\n3DDE/nOB9SX/W44gtYmvByaUeN4tga+QAsAaYC1pMZ8fAG8t4fybAqeQbpSfyrZ9hnSzXk4KdGNK\n+recSKqJrK96LANOKOH8/we4cZB9ryD9CCj17+6HHyPl0ZR5Br0qa2Z5J3B1RJTRL9FzsmG+O7Nh\nfsmTwCNRwgdN0qakwDXg//usKW+HiPhD0bLMRhoHA2uJbFjo7Ig4vJvLMOtVDgbWEpL2Au6JJg77\nbEUZZr2q5fkMrDdJms7QnbdFh8i2pAyzkco1AytFNklvNVVDfnM2AUZHxKhB9ndEGWYjlavTVpZl\npJnNYwd6AH9PY1l6Wl2G2YjkYGBluQd4Uw+UYTYiuc/AynIGMNTKpL8jTXrr9DLMRiT3GZiZmZuJ\nzMzMwcDMzHAwMDMzHAzMzAwHAzMzA/4bnAEAtFd4HGcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x17ff6c50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# histogram of assists grouped by position\n",
    "nba.hist(column='ast', by='pos', sharex=True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
